package com.jingbit.ai.helper;

import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;

public class FilterHelper {
	public static final String SPECIAL_CHARACTER = "[`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~！@#￥%……&*（）——+|{}【】‘；：”“’。，、？]";
	public static boolean specialCharacter(String str) throws PatternSyntaxException {
		// 只允许字母和数字
		// String regEx = "[^a-zA-Z0-9]";
		// 清除掉所有特殊字符
		Pattern p = Pattern.compile(SPECIAL_CHARACTER);
		Matcher matcher = p.matcher(str);
		return matcher.matches();
	}
}
